package com.cy.pj.sys.web.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

public class JsonResult {


//    状态码
    private Integer state=1;//1表示正常，01表示Error
//    状态码信息
    private String message="ok";
//    封装正确的查询结果
    private Object data;
    public JsonResult(){}

    public JsonResult(String message) {
        this.message = message;
    }

    public JsonResult(Object data) {
        this.data = data;
    }

    public JsonResult(Integer state, String message) {
        this.state = state;
        this.message = message;
    }
    //出现异常时，通过此构造方法将异常信息进行封装
    public JsonResult(Throwable exception){
        this(0,exception.getMessage());
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
